import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vite.dev/config/
const ts = Date.now()
export default defineConfig({
  plugins: [react()],
  resolve:{
    alias:{
      '@':'/src'
    }
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://172.27.2.110',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
        secure:true
      },
    }
  },
  build:{
    outDir:`viteBuild`,
    copyPublicDir:true,
    rollupOptions:{
      output:{
        entryFileNames:`js/[name]-[hash]-${ts}.js`,
        chunkFileNames:`js/[name]-[hash]-${ts}.js`,
        assetFileNames:`[ext]/[name]-[hash]-${ts}.[ext]`
      }
    }
  }
})
